//
//  JXBaseWKWebViewController.m
//  JXAddressApp
//
//  Created by zhhw_home on 2018/10/28.
//  Copyright © 2018年 zhhw_home. All rights reserved.
//

#import "JXBaseWKWebViewController.h"
#import "Masonry.h"

@interface JXBaseWKWebViewController()

@property (nonatomic, strong) WKWebViewConfiguration *webViewConfiguration;
@property (nonatomic, strong) WKWebView *webView;


@end

@implementation JXBaseWKWebViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    _webViewConfiguration = [[WKWebViewConfiguration alloc] init];
    _webView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:self.webViewConfiguration];
    [self.view addSubview:_webView];
    
    [_webView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.mas_equalTo(self.view);
        make.bottom.mas_equalTo(self.view.mas_safeAreaLayoutGuideBottom);
    }];
    
    
    NSURLRequest *request = [NSURLRequest requestWithURL:self.webUrl];
    [self.webView loadRequest:request];
    
    if (_webVCTitle.length > 0) {
        self.title = _webVCTitle;
    }
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    
    [self.navigationController setNavigationBarHidden:NO animated:YES];
}

@end
